from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from . import views

urlpatterns = [
    # 发送短信
    url(r'^sms_codes/(?P<mobile>1[3-9]\d{9})/$', views.SmsCodeView.as_view()),
    #发送重置密码的短信验证码
    url(r'^sms_codes/$', views.SmsCodeResetView.as_view()),
    #图片验证码
    url(r'^image_codes/(?P<image_code_id>.+)/$', views.ImageCodeView.as_view()),
    # 判断用户名是否重复
    url(r'^usernames/(?P<username>\w+)/count/$', views.UsernameCountView.as_view()),
    #判断图片验证码是否正确
    url(r'^accounts/(?P<username>\w+)/sms/token/$', views.ImageCode2CountView.as_view()),
    #短信验证码校验，返回改密码token
    url(r'^accounts/(?P<username>\w+)/password/token/$', views.SmsCode2VerifyView.as_view()),
    # 判断手机号是否重复
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 保存注册用户数据
    url(r'^users/$', views.UserView.as_view()),
    # JWT实现登录
    # url(r'^authorizations/$', obtain_jwt_token),
    url(r'^authorizations/$', views.UserLoginView.as_view()),
    # 修改密码
    url(r'^users/(?P<pk>\w+)/password/$', views.UserResetView.as_view()),
    # 个人信息展示
    url(r'^user/$', views.UserDetailView.as_view()),
    # 保存email
    url(r'^email/$', views.UserEmailView.as_view()),
    url(r'^emails/verification/$', views.EmailVerifyView.as_view()),
    url(r'^users/(?P<pk>\d+)/password/$', views.UpdatePasswordView.as_view()),  # 修改密码
]
